package com.coship.vas.dapg.util;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/** 获取spring ApplicationContext  */
@Component("springBeanFactoryUtil")
public class SpringBeanFactoryUtil implements ApplicationContextAware
{
	private static ApplicationContext context = null;

	public static Object getBean(String id)
	{
		return context.getBean(id);
	}

	public static boolean containsBeanName(String id)
	{
		boolean result = false;
		result = context.containsBean(id);
		return result;
	}

	public static ApplicationContext getApplicationContext()
	{
		return context;
	}

	@Override
	public void setApplicationContext(ApplicationContext applicationContext)
			throws BeansException
	{
		context = applicationContext;
	}

}
